
//
// type MembersListView -- view for MembersList
//
function MembersListView(dom_elt) {
		this._de = dom_elt;
		this.getMembersList  = function() { return jQuery(this._de).find("tr.item-"); }
}
MembersListView.prototype._bind      = function(model) { 
		this.model = model; 
		this.bind();
		return this;
}
MembersListView.prototype.bind       = function() { 
}

//
// type MemberView -- view for member
//

function MemberView(dom_elt) {
		this._de = dom_elt;
		this.model = null;
}
MemberView.prototype._bind           = function(model) { 
		this.model = model; 
		this.bind();
		return this;
}
MemberView.prototype.bind            = function() { 
		jQuery(this.getRoleSelector()).bind("change", this.model, this.model.onChangeRole);
		jQuery(this.getDeleteButton()).bind("click", this.model, this.model.onDelete);
}
MemberView.prototype.getRoleSelector = function() { return jQuery(this._de).find(".select-").get(0); }
MemberView.prototype.getDeleteButton = function() { return jQuery(this._de).find('.exclude-').get(0); }
MemberView.prototype.getUserId       = function() { return jQuery(this._de).find('.userid-').val(); }
MemberView.prototype.getAjaxUrl      = function() { return jQuery('#member_submit_url').attr('href'); }
MemberView.prototype.rmPanel         = function() { jQuery(this._de).remove(); }
MemberView.prototype.notifyChange    = function() { return jQuery(this._de).removeClass('changed-').removeClass('error-').addClass('change-'); }
MemberView.prototype.notifyChanged   = function() { return jQuery(this._de).removeClass('change-').removeClass('error-').addClass('changed-'); }
MemberView.prototype.notifyError     = function() { return jQuery(this._de).removeClass('changed-').removeClass('change-').addClass('error-'); }



/// do it
jQuery().ready(function () {
    var mp = new MembersList(jQuery("table.list-").get(0));
    mp.bind();
});
